//
//  Common.h
//  供销宝
//
//  Created by 金晶 on 17/2/6.
//  Copyright © 2017年 金晶. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum {
    
    DataTypehhmm, // 时间-hh:mm
    DataTypeyydd,
    DataTypeAll
    
}DataType;

@interface Common : NSObject

@property (nonatomic,copy) dispatch_block_t activityfail;

@property (nonatomic,strong) NSString *userId;

@property (nonatomic,strong) NSMutableArray *contactArray;

+ (Common *)manager;

/*密码验证 8位以上，英文+字母*/
- (BOOL)isValidatePassWord:(NSString *)password;
//*手机号码验证
-(BOOL) isValidateMobile:(NSString *)mobile;

//身份证号
- (BOOL) validateIdentityCard: (NSString *)identityCard;

/*邮箱验证 MODIFIED BY HELENSONG*/
-(BOOL)isValidateEmail:(NSString *)email;


/*! 倒计时方法
 */
-(void)getfirstActivityCountWithtime:(int)time WithButton:(UIButton *)button forEnd:(void (^)(void))end;

/*! 倒计时方法
 *  要写方法去掉用该方法
 *  入参时间与block
 *  block返回
 */
-(void)getActivityCountdownforTime:(int)time WithButton:(UIButton *)button forEnd:(void(^)(void))end;


/*计算文本的宽和高
 * 入参：字符串以为所适位于控制的高度
 * 返回为Size
 */
-(CGSize)calculationfontwidth:(NSString *)str Withheight:(CGFloat)height;


/*判断图片长度&宽度*/
+(CGSize)imageShowSize:(UIImage *)image;

//随机生成msdid
- (NSString *)generateMsgId;

/*UITextField输入小数限制(小数点前6位, 后2位)*/
- (BOOL)decimalRestrictiontextField:(UITextField *)textField ChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;

//拼接json
- (NSDictionary *)returnJsonData:(NSDictionary *)dict ;

- (NSString *)returnJsonStr:(NSDictionary *)dict;

//获取当前时间
- (NSString *)getCurrentTime:(DataType)type;

//表情匹配
- (NSMutableAttributedString *)facepattern:(NSString *)message ;

- (NSString *)replaceEmoji:(NSString *)message ;

//获取系统文件
- (NSString *)documentFolderPath;

//获取时间戳
- (NSString *)timeInterval;

//整数向上取整
int integerCeil(int number);

@end
